use POE;
use URI::Escape;

{
	irc_commands => {
		wa	=> sub {
			my ($source, $targets, $args, $account) = @_;
			BotIrc::check_ctx() or return;
			my $nick = BotIrc::nickonly($source);
			my $ctx = BotIrc::ctx_frozen;

			BotHttp::get("https://api.wolframalpha.com/v1/result?appid=$BotIrc::config->{wolfram_appid}&i=".uri_escape($args), sub {
				my $data = shift;
				BotIrc::send_wisdom($ctx, "Wolfram|Alpha: $data");
				return;
			}, sub {
				BotIrc::send_noise($ctx, ".info error: query '$args' failed: ".shift);
				return;
			});
		},
	},
};
